package com.jianguozh.difs.framework.validator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * 字段值唯一性校验
 *
 * @author hanrs
 * @email 40736130@qq.com
 * @since 2022/4/23 2:48 PM
 */
@Documented
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Constraint(validatedBy = {UniqueValidator.class})
@Retention(RetentionPolicy.RUNTIME)
public @interface UniqueValid {

    /**
     * 实体对应的表名
     */
    String tableName() default "";

    /**
     * 唯一字段列名(数据库字段名)
     */
    String[] columns() default {};

    /**
     * 校验不通过消息提示
     */
    String message() default "已存在该字段!";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
